﻿<?php
/*
 * 点击参加子活动
 */
require_once '../init.php';
define('TEMPLATE_PATH', WANYA_ROOT . '/m/view/');

/*$appid = "wxbee55928ce2bfa25";
$secret = "1370b77e269a256ede75d700c8054ce6";

$code = $_GET["code"];

// 得到token
$get_token_url = 'https://api.weixin.qq.com/sns/oauth2/access_token?appid='.$appid.'&secret='.$secret.'&code='.$code.'&grant_type=authorization_code';
$res=file_get_contents($get_token_url);

$token_obj = json_decode($res,true);
$openid = $token_obj['openid'];
$access_token = $token_obj['access_token'];*/

// TODO 通过openid，去检索用户

$User_Info_Model = new User_Info_Model();

$openid = "21111111";
$userSimpleInfos = array_filter($User_Info_Model->getViewUserInfo($openid));

$userSimpleInfo = $userSimpleInfos[0];
var_dump($userSimpleInfo);
//找出活动的属性信息
$Activity_Model = new Activity_Model();
$ActivityResult = array_filter($Activity_Model->selectActivity());
//算出当前活动ID
$activity = $ActivityResult[0];
$activity_id = $_POST['activity_id'];
echo($activity_id);
echo( " : ");

$userInfo = $userSimpleInfos[0];
$uid = $_POST['uid'];
echo($uid);
$sub_activity_id = $_POST['id'];




if($activity_id==null){
    echo("数据异常");
    include View::getView('activity/applyError');
    View::output();
}
if($uid==null){
    echo("数据异常");
    include View::getView('activity/applyError');
    View::output();
}
if($sub_activity_id==null){
    echo("数据异常");
    include View::getView('activity/applyError');
    View::output();
}
// TODO 仅仅是跳转到文件上传页面

include View::getView('activity/toUploadPage');
View::output();


?>